﻿<%@ Page Title="Manage Items" Language="C#" MasterPageFile="~/MasterPages/Frontend.Master" AutoEventWireup="true" CodeFile="ManageItems.aspx.cs" Inherits="Demos_ManageItems" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
        DataSourceID="EntityDataSource1" DataTextField="Nom" DataValueField="Id">
    </asp:DropDownList>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=CirrusEntities" DefaultContainerName="CirrusEntities" 
        EnableFlattening="False" EntitySetName="Items" Select="it.[Id], it.[Nom]">
    </asp:EntityDataSource>
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="Id" 
        DataSourceID="EntityDataSource2" InsertItemPosition="LastItem">
       
        <EditItemTemplate>
            <tr style="background-color:#008A8C;color: #FFFFFF;">
                <td>
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                </td>
                <td>
                    <asp:Label ID="IdLabel1" runat="server" Text='<%# Eval("Id") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ItemIdTextBox" runat="server" Text='<%# Bind("ItemId") %>' />
                </td>
                <td>
                    <asp:TextBox ID="MarchandIdTextBox" runat="server" 
                        Text='<%# Bind("MarchandId") %>' />
                </td>
                <td>
                    <asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>' />
                </td>
                <td>
                    <asp:CheckBox ID="SpecialCheckBox" runat="server" 
                        Checked='<%# Bind("Special") %>' />
                </td>
                <td>
                    <asp:TextBox ID="Prix1TextBox" runat="server" Text='<%# Bind("Prix1") %>' />
                </td>
                <td>
                    <asp:TextBox ID="UniteTextBox" runat="server" Text='<%# Bind("Unite") %>' />
                </td>
                <td>
                    <asp:TextBox ID="QuantiteTextBox" runat="server" 
                        Text='<%# Bind("Quantite") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ItemTextBox" runat="server" Text='<%# Bind("Item") %>' />
                </td>
                <td>
                    <asp:TextBox ID="MarchandTextBox" runat="server" 
                        Text='<%# Bind("Marchand") %>' />
                </td>
            </tr>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr style="">
                <td>
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                </td>
                <td>
                    <asp:TextBox ID="IdTextBox" runat="server" Text='<%# Bind("Id") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ItemIdTextBox" runat="server" Text='<%# Bind("ItemId") %>' />
                </td>
                <td>
                    <asp:TextBox ID="MarchandIdTextBox" runat="server" 
                        Text='<%# Bind("MarchandId") %>' />
                </td>
                <td>
                    <asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>' />
                </td>
                <td>
                    <asp:CheckBox ID="SpecialCheckBox" runat="server" 
                        Checked='<%# Bind("Special") %>' />
                </td>
                <td>
                    <asp:TextBox ID="Prix1TextBox" runat="server" Text='<%# Bind("Prix1") %>' />
                </td>
                <td>
                    <asp:TextBox ID="UniteTextBox" runat="server" Text='<%# Bind("Unite") %>' />
                </td>
                <td>
                    <asp:TextBox ID="QuantiteTextBox" runat="server" 
                        Text='<%# Bind("Quantite") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ItemTextBox" runat="server" Text='<%# Bind("Item") %>' />
                </td>
                <td>
                    <asp:TextBox ID="MarchandTextBox" runat="server" 
                        Text='<%# Bind("Marchand") %>' />
                </td>
            </tr>
        </InsertItemTemplate>
        <ItemTemplate>
            <tr style="background-color:#DCDCDC;color: #000000;">
                <td>
                    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                        Text="Delete" />
                    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                </td>
                <td>
                    <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
                </td>
                <td>
                    <asp:Label ID="ItemIdLabel" runat="server" Text='<%# Eval("ItemId") %>' />
                </td>
                <td>
                    <asp:Label ID="MarchandIdLabel" runat="server" 
                        Text='<%# Eval("MarchandId") %>' />
                </td>
                <td>
                    <asp:Label ID="DateLabel" runat="server" Text='<%# Eval("Date") %>' />
                </td>
                <td>
                    <asp:CheckBox ID="SpecialCheckBox" runat="server" 
                        Checked='<%# Eval("Special") %>' Enabled="false" />
                </td>
                <td>
                    <asp:Label ID="Prix1Label" runat="server" Text='<%# Eval("Prix1") %>' />
                </td>
                <td>
                    <asp:Label ID="UniteLabel" runat="server" Text='<%# Eval("Unite") %>' />
                </td>
                <td>
                    <asp:Label ID="QuantiteLabel" runat="server" Text='<%# Eval("Quantite") %>' />
                </td>
                <td>
                    <asp:Label ID="ItemLabel" runat="server" Text='<%# Eval("Item") %>' />
                </td>
                <td>
                    <asp:Label ID="MarchandLabel" runat="server" Text='<%# Eval("Marchand") %>' />
                </td>
            </tr>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                                <th runat="server">
                                </th>
                                <th runat="server">
                                    Id</th>
                                <th runat="server">
                                    ItemId</th>
                                <th runat="server">
                                    MarchandId</th>
                                <th runat="server">
                                    Date</th>
                                <th runat="server">
                                    Special</th>
                                <th runat="server">
                                    Prix1</th>
                                <th runat="server">
                                    Unite</th>
                                <th runat="server">
                                    Quantite</th>
                                <th runat="server">
                                    Item</th>
                                <th runat="server">
                                    Marchand</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
  
    </asp:ListView>
    <asp:EntityDataSource ID="EntityDataSource2" runat="server" 
        AutoGenerateWhereClause="True" ConnectionString="name=CirrusEntities" 
        DefaultContainerName="CirrusEntities" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
        EntitySetName="Prixes" Where="">
        <WhereParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="ItemId" 
                PropertyName="SelectedValue" Type="Int32" />
        </WhereParameters>
    </asp:EntityDataSource>
</asp:Content>

